Skip to content

[ART-2156] Migrate from poetry to uv#36

Merged
ucizi-turintech merged 5 commits into
mainfrom
feat/sample-python-project-uv-rewrite
Jul 23, 2026
Merged

[ART-2156] Migrate from poetry to uv#36
ucizi-turintech merged 5 commits into
mainfrom
feat/sample-python-project-uv-rewrite

Conversation

@ucizi-turintech

@ucizi-turintech ucizi-turintech commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Convert pyproject.toml to PEP 621 metadata with the hatchling backend; replace poetry.lock with uv.lock
  • Keep main as a project script (uv run main); add taskipy tasks test and benchmark (uv run task <name>), matching the convention in agent-management-api
  • benchmark runs artemis_scripts/benchmark.py --runs 3 --output artemis_results.csv
  • Fix an fd leak in SqlQuery: connections were never closed and were only reclaimed by cycle GC. On Python 3.14 the new incremental GC reclaims them lazily enough that benchmark runs blow past a 1024 fd limit and crash with EMFILE
  • Update README commands accordingly

Transition compatibility (poetry still works)

Falcon rolls out its command change per environment (dev on merge, staging on component release, prod on platform release), while this repo's main is shared by all environments. To avoid breaking staging/prod — which keep running pip3 install poetry && python -m poetry install etc. until their releases ship — the pyproject stays resolvable by poetry 2.x, and poetry.lock is kept alongside uv.lock:

  • requires-python = ">=3.8,<4.0" (taskipy caps python at <4.0; poetry needs the bound to resolve)
  • psutil relaxed to >=5.9,<8 so taskipy's psutil<7 pin resolves without uv's override-dependencies, which poetry has no equivalent for

Verified the full old command sequence (poetry install, poetry run pytest --benchmark-skip tests/, the benchmark script) against this branch with a fresh pip install poetry (2.4.1). Once the falcon change reaches prod, poetry support (its lock file and the constraints above) can be dropped.

Test plan

  • uv run main runs the demo
  • uv run task test — 79 passed, 18 skipped
  • uv run task benchmark completes 3 runs and writes artemis_results.csv, verified under ulimit -n 1024 on Python 3.14.2
  • Old poetry commands verified working against this branch (prod simulation)

Related PRs

  • turintech/falcon-optimisation-api#1745 — merge after this PR

🤖 Generated with Claude Code

ucizi-turintech and others added 5 commits July 22, 2026 18:36
Convert pyproject.toml to PEP 621 metadata with the hatchling backend,
replace poetry.lock with uv.lock, and add taskipy tasks for test and
benchmark. The main entry point stays a project script (uv run main).
taskipy pins psutil<7, so an override-dependencies entry keeps psutil 7.x.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Each call leaked a connection whose fd was only reclaimed by cycle GC.
Python 3.14's incremental GC collects these lazily enough that benchmark
runs exceed a 1024 fd limit and crash with EMFILE.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Falcon staging/prod keep issuing the old poetry commands until their
releases ship, and poetry 2.x can install a PEP 621 project as long as
resolution succeeds. Bound requires-python at <4.0 (taskipy caps python
there) and relax psutil to >=5.9,<8 so taskipy's psutil<7 pin resolves
without uv's override-dependencies, which poetry has no equivalent for.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Keeps poetry-based installs deterministic until falcon prod switches to
the uv commands.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ucizi-turintech ucizi-turintech changed the title Migrate from poetry to uv [ART-2156] Migrate from poetry to uv Jul 22, 2026

@m-truscott m-truscott left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can remove poetry.lock completely

@ucizi-turintech

ucizi-turintech commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

I guess we can remove poetry.lock completely

@m-truscott we probably can. I opted to keep it for the transitionary period while falcon on prod still has the old commands. plan is to remove it once the falcon change reaches prod. But I think poetry would autogenerate a lockfile if there wasn't one anyway.

@ucizi-turintech
ucizi-turintech merged commit 88efece into main Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants